//
//  UserView1.m
//  FoodFamily
//
//  Created by dlios on 15-6-22.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "UserView1.h"

@implementation UserView1
-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self ) {
        [self creatSubView];
        
    }
    
    return self;
}

-(void)creatSubView{
    
 
    self.imageV = [[UIImageView alloc]initWithFrame:CGRectMake(10, 50, self.frame.size.width-20, 200)];
    self.imageV.image = [UIImage imageNamed:@"bg_share_large@2x.png"];
    [self addSubview:self.imageV];
    
    self.user_image = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 100, 100)];
    self.user_image.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.user_image];
    [self.user_image release];
    
    
    self.user_name = [[UILabel alloc]initWithFrame:CGRectMake(self.user_image.frame.size.width + 10, 5, (self.imageV.frame.size.width - self.user_image.frame.size.width - 20), 30)];
    self.user_name.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.user_name];
    [self.user_name release];
    
    self.tobeloved = [[UILabel alloc]initWithFrame:CGRectMake(self.user_image.frame.size.width + 10, 30, (self.imageV.frame.size.width - self.user_image.frame.size.width - 20), 30)];
    self.tobeloved.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.tobeloved];
    [self.tobeloved release];

    
//    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(self.user_image.frame.size.width + 10, 65, 55, 30)];
//    label1.backgroundColor = [UIColor redColor];
//    [self.imageV addSubview:label1];
//    label1.layer.masksToBounds = YES;
//    label1.layer.cornerRadius = 7;
//    label1.textColor = [UIColor yellowColor];
//    label1.text = @"关注";
//    label1.textAlignment = NSTextAlignmentCenter;
//    
//       [label1 release];
    
    UIView *vie1 = [[UIView alloc]initWithFrame:CGRectMake(0, 140, self.imageV.frame.size.width, 1)];
    vie1.backgroundColor = [UIColor grayColor];
    vie1.alpha = 0.3;
    [self.imageV addSubview:vie1];
    [vie1 release];
    
    self.user_tweet_count = [[UIButton alloc]initWithFrame:CGRectMake(0, 130, self.imageV.frame.size.width/3-5, self.imageV.frame.size.height - 135)];
    self.user_tweet_count.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.user_tweet_count];
    [self.user_tweet_count release];
    self.imageV.userInteractionEnabled = YES;
    [self.user_tweet_count addTarget:self action:@selector(button1Action) forControlEvents:UIControlEventTouchUpInside];
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(0, self.imageV.frame.size.height-25 , self.imageV.frame.size.width/3-5, 20)];
    label2.text = @"美食足迹";
    label2.alpha = 0.7;
    label2.font = [UIFont systemFontOfSize:19];
    [self.imageV addSubview:label2];
    label2.textAlignment = NSTextAlignmentCenter;
    [label2 release];
    
    UIView *vie2 = [[UIView alloc]initWithFrame:CGRectMake(self.imageV.frame.size.width/3, 140, 1, self.imageV.frame.size.height - 140)];
    vie2.backgroundColor = [UIColor grayColor];
    vie2.alpha = 0.3;
    [self.imageV addSubview:vie2];
    [vie2 release];
    
    
    
    self.user_follow_count = [[UIButton alloc]initWithFrame:CGRectMake(self.imageV.frame.size.width/3, 130, self.imageV.frame.size.width/3-5, self.imageV.frame.size.height - 135)];
    self.user_follow_count.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.user_follow_count];
    
    [self.user_follow_count release];
     [self.user_follow_count addTarget:self action:@selector(button2Action) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(self.imageV.frame.size.width/3, self.imageV.frame.size.height-25 , self.imageV.frame.size.width/3-5, 20)];
    label3.text = @"关注";
    label3.alpha = 0.7;
     label3.font = [UIFont systemFontOfSize:19];
    [self.imageV addSubview:label3];
    label3.textAlignment = NSTextAlignmentCenter;
    [label3 release];

    UIView *vie3 = [[UIView alloc]initWithFrame:CGRectMake(self.imageV.frame.size.width/3 * 2, 140, 1, self.imageV.frame.size.height - 140)];
    vie3.backgroundColor = [UIColor grayColor];
    vie3.alpha = 0.3;
    [self.imageV addSubview:vie3];
    [vie3 release];
    
    
    self.user_fans_count = [[UIButton alloc]initWithFrame:CGRectMake(self.imageV.frame.size.width/3 *2, 130, self.imageV.frame.size.width/3, self.imageV.frame.size.height - 135)];
    self.user_fans_count.backgroundColor = [UIColor clearColor];
    [self.imageV addSubview:self.user_fans_count];
    [self.user_fans_count release];
    
     [self.user_fans_count addTarget:self action:@selector(button3Action) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *label4 = [[UILabel alloc]initWithFrame:CGRectMake(self.imageV.frame.size.width/3*2 , self.imageV.frame.size.height-25 , self.imageV.frame.size.width/3-5, 20)];
    label4.text = @"粉丝";
    label4.alpha = 0.7;
     label4.font = [UIFont systemFontOfSize:19];
    [self.imageV addSubview:label4];
    label4.textAlignment = NSTextAlignmentCenter;
    [label4 release];

    
    
    
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, self.imageV.frame.size.height + 60, self.imageV.frame.size.width, 50)];
    label.backgroundColor = [UIColor clearColor];
    [self addSubview:label];
    [label release];
    label.text = @"Ta的美食足迹";
    label.font = [UIFont systemFontOfSize:20];
   
    
    
    
    self.imageV1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.imageV.frame.size.height + 130, self.imageV.frame.size.width, self.imageV.frame.size.height - 30)];
    self.imageV1.backgroundColor = [UIColor clearColor];
    self.imageV1.image = [UIImage imageNamed:@"bg_share_large@2x.png"];
    [self addSubview:self.imageV1];
    self.imageV1.userInteractionEnabled = YES;
    [self.imageV1 release];
    
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, (self.imageV1.frame.size.height / 3) * 2 + 10, self.imageV1.frame.size.width, 1)];
    view.backgroundColor = [UIColor grayColor];
    view.alpha = 0.5;
    [self.imageV1 addSubview:view];
    [view release];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(5, (self.imageV1.frame.size.height / 3) * 2 + 10, self.imageV1.frame.size.width - 5, self.imageV1.frame.size.height/3 - 5);
    button.backgroundColor = [UIColor clearColor];
    [self.imageV1 addSubview:button];
    [button setTitle:@"查看更多足迹" forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:19];
    [button setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    
    
}



-(void)buttonAction{

    
    [self.Mydelegate bringButton];
    

}

-(void)button1Action{

    [self.Mydelegate bringButton1];
}

-(void)button2Action{
    [self.Mydelegate bringButton2];

}

-(void)button3Action{

    [self.Mydelegate bringButton3];
}

-(void)dealloc{

    [_imageV release];
    [_user_image release];
    [_tobeloved release];
    [_user_name release];
    [_level_title release];
    [_user_tweet_count release];
    [_user_follow_count release];
    [_user_fans_count release];
    [_imageV1 release];
    [super dealloc];
}

@end
